package com.appkubes.mall.admin.application.user.account.account.controller;

import com.appkubes.cloud.config.params.paramValid.ParamValid;
import com.appkubes.common.Response;
import com.appkubes.mall.admin.application.user.account.account.entity.dto.AccountResultDTO;
import com.appkubes.mall.admin.application.user.account.account.entity.dto.AccountStatisDTO;
import com.appkubes.mall.admin.application.user.account.account.entity.vo.AccountSearchVO;
import com.appkubes.mall.admin.application.user.account.account.service.UserAccountService;
import com.appkubes.mall.core.controller.BaseMallUserAccountController;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: Rongjie
 * @Date: 2020/2/28
 * @Description:
 */
@Api(tags = "用户账户(UserAccountController)")
@RestController
@RequestMapping("/user/account")
public class UserAccountController extends BaseMallUserAccountController {

    @Resource
    UserAccountService userAccountService;

    @ApiOperation("用户账户列表")
    @GetMapping("/search")
    public Response<IPage<AccountResultDTO>> search(@ParamValid AccountSearchVO accountSearchVO) {
        return Response.success(userAccountService.search(accountSearchVO));
    }

    @ApiOperation("统计")
    @GetMapping("/statis")
    public Response<AccountStatisDTO> statis(@ParamValid AccountSearchVO accountSearchVO) {
        return Response.success(userAccountService.statis(accountSearchVO));
    }
}
